package com.zznj.xzjc.adapter;

import android.view.View;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;
import com.zznj.xzjc.net.entity.LcjdBean;
import com.zznj.xzjc.utils.StringUtils;
import com.zznj.xzjc.utils.TimeUtils;

import java.util.HashMap;
import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class ZnyjAdapter extends BaseQuickAdapter<LcjdBean, BaseViewHolder> {

    private int queryType;
    public ZnyjAdapter(int layoutResId, @Nullable List<LcjdBean> data,int queryType) {
        super(layoutResId, data);
        this.queryType = queryType;
    }

    private HashMap<Integer, String> hjMap = new HashMap<Integer, String>() {{
        put(0, "行政受理"); put(29, "已做出行政处罚，已结案");
        put(1, "行政立案");
        put(3, "行政不立案");
        put(2, "行政处罚");
        put(38, "行政复议");
        put(4, "行政撤案");
        put(39, "催告");
        put(40, "行政执行");
        put(42, "申请强制执行");
        put(41, "撤回强制执行");
        put(51, "结案");
        put(53, "法院受理");
        put(52, "法院不予受理");
        put(43, "法院立案");
        put(44, "法院不予立案");
        put(56, "裁定准予撤回执行");
        put(45, "裁定准予执行");
        put(46, "裁定不予执行");
        put(47, "终结本次执行");
        put(54, "终结执行");
        put(55, "执行完毕");
    }};

    @Override
    protected void convert(BaseViewHolder helper, LcjdBean item) {
        helper.addOnClickListener(R.id.ycbBtn);
        if (queryType == 1000) {
            helper.setText(R.id.lcjdTitle, item.getCaseName())
                    .setText(R.id.lcjdLrdw, "录入单位：" + item.getOrgName())
                    .setText(R.id.ycbBtn,"已催办")
                    .setText(R.id.lcjdXzsl, "案件状态：" + item.getCaseStateName());
            helper.setText(R.id.lcjdBlsj, "录入时间：" + TimeUtils.getTime(item.getInputTime(), "yyyy-MM-dd HH:mm:ss"));
            helper.setText(R.id.cfjeTv, "处罚金额：￥" + StringUtils.formatMoney(item.getPenaltyMoney(),2));
            helper.setText(R.id.zhblsjTv, "办理时间：" + TimeUtils.getTime(item.getLatestPocessTime(), "yyyy-MM-dd HH:mm:ss"));
            helper.getView(R.id.yqLinear).setVisibility(View.GONE);
            helper.getView(R.id.ycbBtn).setVisibility(View.GONE);
        } else if(queryType == 1001){
            helper.setText(R.id.lcjdTitle, item.getTitle())
                    .setText(R.id.lcjdLrdw, "发送单位：" + item.getSendOrgName())
                    .setText(R.id.lcjdBlsj, "发送时间：" + TimeUtils.getTime(item.getSendTime(), "yyyy-MM-dd HH:mm:ss"))
                    .setText(R.id.ycbBtn,"已催办")
                    .setText(R.id.cfjeTv,"接收单位："+item.getReceiveOrgName())
                    .setText(R.id.yqtsTv,item.getTimeOutDay());;
            helper.getView(R.id.cfjeTv).setVisibility(View.VISIBLE);
            helper.getView(R.id.zhblsjTv).setVisibility(View.GONE);
            helper.setText(R.id.yqlabel,"逾期天数：");
            helper.getView(R.id.lcjdXzsl).setVisibility(View.GONE);
            helper.getView(R.id.lcjdJinGaoImg).setVisibility(View.GONE);
            helper.getView(R.id.yqLinear).setVisibility(View.VISIBLE);
            if(StringUtils.isEmpty(item.getPressId())){
                helper.getView(R.id.ycbBtn).setVisibility(View.GONE);
            }else{
                helper.getView(R.id.ycbBtn).setVisibility(View.VISIBLE);
            }
        }else {
            helper.setText(R.id.lcjdTitle, item.getCaseName())
                    .setText(R.id.lcjdLrdw, "录入单位：" + item.getOrgName())
                    .setText(R.id.ycbBtn,"已催办")
                    .setText(R.id.lcjdXzsl, "案件状态：" + item.getCaseStateName());
            helper.setText(R.id.lcjdBlsj, "办理时间：" + TimeUtils.getTime(item.getLatestPocessTime(), "yyyy-MM-dd HH:mm:ss"));
            helper.getView(R.id.cfjeTv).setVisibility(View.GONE);
            helper.getView(R.id.zhblsjTv).setVisibility(View.GONE);
            helper.setText(R.id.yqtsTv,item.getWarnTime());
            helper.setText(R.id.yqlabel,"逾期天数：");
            helper.getView(R.id.lcjdJinGaoImg).setVisibility(View.GONE);
            if(StringUtils.isEmpty(item.getPressId())){
                helper.getView(R.id.ycbBtn).setVisibility(View.GONE);
            }else{
                helper.getView(R.id.ycbBtn).setVisibility(View.VISIBLE);
            }
        }
    }
}
